home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 2000 #3 / Sun Solutions CD Volume 3, 2003 (704-7473-10 Rev. J)(Sun Microsystems, Inc.)(2003).iso / startcd.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2003-08-20  |  8KB  |  287 lines

  1. #!/bin/sh 
  2. # Installation script for Sun Catalyst CDs
  3. #
  4. # Copyright 1997, SunSoft, Inc.
  5. #
  6. # Author: marc@sacoolas.net 
  7. # Date: October 10, 1997
  8. # Last Modified 12-5-97
  9. #
  10. # Modified 5-2-03
  11. # Paul Diakos
  12. #
  13. # initialize variables
  14. DISC_NAME=Sun_Solutions_CD-February_03
  15. ISSUE_NAME="Sun Solutions CD"
  16. ISSUE_DATE="Volume 3, 2003"
  17. PORT_NUMBER=7999
  18.  
  19. export ISSUE_NAME ISSUE_DATE PORT_NUMBER
  20.  
  21. dir_exist=0
  22. echo ""
  23. echo "          $ISSUE_NAME $ISSUE_DATE initializing ..."
  24. echo ""
  25.                         
  26.  
  27.  
  28. # set CDMOUNT to path from the command line arguements
  29. CDMOUNT=`expr \
  30.         $0'/' : '\(/\)[^/]*//*$' \
  31.         \| $0'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \
  32.         \| .`
  33.  
  34. # if command line path is current directory then set CDMOUNT to pwd
  35. # CDMOUNT cannot be set to . because other programs/scripts
  36. # need the absolute path in CD_MOUNT
  37. if [ "$CDMOUNT" = "." ]; then
  38.         CDMOUNT=`pwd`
  39. fi
  40. CD_MOUNT=$CDMOUNT
  41. export CD_MOUNT DISC_DIR
  42.  
  43. #
  44. # os type and arch
  45. #
  46. check_os()
  47. ######################################################################
  48. {
  49.         os_ver="`/bin/uname -r | /bin/grep 5\[.]`"
  50.  
  51.         export os_ver
  52.  
  53.         if [ -n "$os_ver" ]; then
  54. # must be running Solaris 2.x
  55.                 machine_type="`/bin/uname -m`"
  56.                 os_type="`/bin/uname -r`"
  57.                 if [ "$machine_type" = "i86pc" ]; then
  58.                         OS_TYPE=""
  59.                         CDWARE_ENV=Solaris_x86
  60.                 else
  61. # must be on a SPARCarchitecture-based machine
  62.                         bcp="`/bin/pkginfo | /bin/grep SUNWbcp`"
  63. # check for bcp and set CDWARE_ENV accordingly???
  64.                         CDWARE_ENV=Solaris_2
  65.                 fi
  66.         else
  67. # must be running Solaris 1.x
  68.                 GUI=products/bin/Solaris_1/cdmanager
  69.                 GUI_BIN=cdmgr
  70.                 CDWARE_ENV=Solaris_1
  71.         test_sunos="`/bin/uname -r | /bin/grep 4.1.4`"
  72.         if [ -n "$test_sunos" ]; then
  73.             SUNOS_VER=4.1.4
  74.         else
  75.             SUNOS_VER=""
  76.         fi
  77.  
  78.         fi
  79.  
  80. }
  81.  
  82. check_os
  83. DISC_DIR="$CDMOUNT/products/bin/httpd/$CDWARE_ENV"
  84. export LD_LIBRARY_PATH CLASSPATH PATH JAVA_HOME DISC_DIR
  85.  
  86. LD_LIBRARY_PATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/lib:/usr/openwin/lib:/usr/lib:$LD_LIBRARY_PATH
  87. CLASSPATH=.:$CD_MOUNT/products/NetResultsCD:$CD_MOUNT/products/bin/gui/CDlaunch:$CD_MOUNT/products/bin/java/$CDWARE_ENV/lib/rt.jar:$CLASSPATH
  88.  
  89.  
  90.  
  91. JAVA_HOME=$CD_MOUNT/products/bin/java/$CDWARE_ENV
  92.  
  93. if [ "$OPENWINHOME" = "" ]; then
  94.     OPENWINHOME="/usr/openwin"; export OPENWINHOME    
  95. fi
  96. if [ "$HOME" = "" ]; then
  97.     
  98.         HOME="/"; export HOME
  99. fi
  100.  
  101. # set the dir where all the companies live
  102. PRODUCT_DIR=$CD_MOUNT/products
  103. export PRODUCT_DIR 
  104.  
  105. # get nodename
  106. NODENAME=`/bin/hostname`
  107.  
  108. if [ "$NODENAME" = "" ];then 
  109.     NODENAME = "localhost"
  110. fi
  111. export NODENAME
  112.  
  113. # legal, readme, etc.
  114.         #if [ "$CDWARE_ENV" != "Solaris_1" -a "$MARC" = "" ]; then
  115.                 #use starting java app
  116.                 #$CD_MOUNT/products/bin/java/$CDWARE_ENV/bin/jre CDaudio $CD_MOUNT/products/bin/gui/CDlaunch& 
  117.         #        $CD_MOUNT/products/bin/java/$CDWARE_ENV/bin/jre CDlaunch $CD_MOUNT/products/bin/gui/CDlaunch $DISC_DIR                                    
  118.         #else
  119.                # cat $CD_MOUNT/products/bin/gui/CDlaunch/license.txt
  120.         #fi
  121.  
  122. # exit if user has requested from CDlaunch; do clean-up
  123. #if [ -f $DISC_DIR/nostart ];then
  124. #    # kill sound
  125. #    if [ -r $DISC_DIR/sound.pid ]; then
  126. #        kill -9 `cat $DISC_DIR/sound.pid`
  127. #    fi
  128. #    rm -r $DISC_DIR
  129. #    exit 0
  130. #fi
  131.  
  132.         if [ "$CDWARE_ENV" != "Solaris_x86" ]; then
  133.     CLASSPATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/java_301:$CLASSPATH
  134.     else
  135.         CLASSPATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/java_30:$CLASSPATH
  136.     fi
  137.  
  138.  
  139. #if [ ! -h $DISC_DIR/products ]; then
  140. #        ln -s $PRODUCT_DIR $DISC_DIR
  141. #fi
  142. #
  143. #if [ ! -h $DISC_DIR/.cgi-bin ]; then
  144. #        ln -s $PRODUCT_DIR/.bin/httpd/$CDWARE_ENV $DISC_DIR/.cgi-bin
  145. #fi
  146. #
  147. #if [ ! -h $DISC_DIR/home ]; then
  148. #        ln -s $HOME $DISC_DIR/home
  149. #fi
  150.  
  151.  
  152. # get around read-only netresults problem
  153.  
  154.  
  155.  
  156. if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  157.     export XNLSPATH XKEYSYMDB
  158.     PATH=$DISC_DIR:/usr/ucb:$OPENWINHOME/bin:/usr/bin:/usr/sbin:$PATH
  159.     XNLSPATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/nls
  160.     XKEYSYMDB=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/XKeysymDB
  161. else
  162.     OS_REV=`/bin/uname -r | $DISC_DIR/perl -n -e 's?^[0-9]\.([0-9]).*?\1? ? print : print "none";'`
  163.     PATH=$DISC_DIR:/usr/bin:$OPENWINHOME/bin:/usr/sbin:$PATH
  164. fi
  165.     export OS_REV
  166.  
  167. #    WWW_FIRST=http://$NODENAME:$PORT_NUMBER/index.html
  168. #    WWW_HOME=http://$NODENAME:$PORT_NUMBER/index.html
  169.     WWW_HOME=file://$CD_MOUNT/products/intro.html
  170. if [ "$CDWARE_ENV" = "Solaris_2" ]; then
  171.     WWW_FIRST=file://$CD_MOUNT/products/proxywarning.html
  172. else
  173.     WWW_FIRST=file://$CD_MOUNT/products/proxywarning2.html
  174. fi
  175.     # so says Scott and Paul
  176.  
  177. export WWW_HOME WWW_FIRST CDWARE_ENV
  178.  
  179.     echo ""
  180.     echo "Launching Search Server..."
  181.     echo " "
  182.     #CWD=`pwd`
  183.     cd $CD_MOUNT/products/bin/gui/code
  184.         #$CD_MOUNT/products/bin/java2/$CDWARE_ENV/bin/java SCDServer -u 7999 $CD_MOUNT &
  185.         $CD_MOUNT/products/bin/java2/$CDWARE_ENV/bin/java SCDServer -u 7999 $CD_MOUNT/products &
  186.     server_process=$!
  187.     export server_process
  188.  
  189. #SunOS search provision TOAST
  190. #echo $server_process
  191. #exit 0
  192. #if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  193. #        ln -s /tmp/solcd/products/catalog/list.wais.html /tmp/solcd/list.link
  194. #        echo "No Search supported on SunOS"
  195. #else
  196. #        ln -s $PRODUCT_DIR/catalog/list.excite.html /tmp/solcd/list.link
  197. #fi
  198. #
  199.  
  200. search_netscape()
  201. ######################################################################
  202. {
  203. if [ "$NETSCAPE_CATALYST" = "" ]; then
  204. #    PATH=$PATH:$CD_MOUNT/products/bin/gui/$CDWARE_ENV
  205.     NETSCAPE_VERSION="`netscape -version 2>&1| $DISC_DIR/perl -n -e 's?\D*([0-9.]*).*?\1? ? print : print "none"'`"
  206. #echo "NETSCAPE_VERSION=$NETSCAPE_VERSION"
  207. #    
  208.     POST_VERSION_4=`echo $NETSCAPE_VERSION|$DISC_DIR/perl -n -e '/[4-9]\./ ? print "good" : print "bad"'`
  209. #echo "POST_VERSION_4=$POST_VERSION_4"
  210. #    #POST_VERSION_301=`echo $NETSCAPE_VERSION|$DISC_DIR/perl -n -e '/3\.(\d[1-9]|[2-9]\d)/ || /[4-9]\./ ? print "old" : print "good"'`
  211.     if [ $POST_VERSION_4 = "good" ];then
  212.         echo
  213.         echo "Netscape Navigator "$NETSCAPE_VERSION" will be used for the Sun Solutions CD"
  214.         echo ""
  215. #        #echo $PATH
  216.         NETSCAPE_CATALYST=`echo $PATH|$DISC_DIR/perl -n -e '
  217.             @DIRS=split(/:/);
  218.             foreach $dir (@DIRS) {
  219.                 $dir =~ s/\n//;
  220.                 if (-x "$dir/netscape" && -f _) {
  221.                     print "$dir/netscape\n";
  222.                     last;
  223.                 }
  224.             }'`
  225.         export NETSCAPE_CATALYST
  226.     fi
  227. fi
  228. }
  229.  
  230. search_ie()
  231. ######################################################################
  232. {
  233. if [ "$IE_CATALYST" = "" ]; then
  234. #    PATH=$PATH:$CD_MOUNT/products/bin/gui/$CDWARE_ENV
  235.     IE_VERSION="`iexplorer -version 2>&-| $DISC_DIR/perl -n -e 's?\D*([0-9.]*).*?\1? ? print : print "none"'`"
  236. #echo "IE_VERSION=$IE_VERSION"
  237. #    
  238.     POST_VERSION_4=`echo $IE_VERSION|$DISC_DIR/perl -n -e '/[4-9]\./ ? print "good" : print "bad"'`
  239. #echo "POST_VERSION_4=$POST_VERSION_4"
  240. #    #POST_VERSION_301=`echo $IE_VERSION|$DISC_DIR/perl -n -e '/3\.(\d[1-9]|[2-9]\d)/ || /[4-9]\./ ? print "old" : print "good"'`
  241.     if [ $POST_VERSION_4 = "good" ];then
  242.         echo
  243.         echo "Internet Explorer "$IE_VERSION" will be used for the Sun Solutions CD"
  244.         echo ""
  245. #        #echo $PATH
  246.         IE_CATALYST=`echo $PATH|$DISC_DIR/perl -n -e '
  247.             @DIRS=split(/:/);
  248.             foreach $dir (@DIRS) {
  249.                 $dir =~ s/\n//;
  250.                 if (-x "$dir/iexplorer" && -f _) {
  251.                     print "$dir/iexplorer\n";
  252.                     last;
  253.                 }
  254.             }'`
  255.         export IE_CATALYST
  256.         #echo "loop, IE_CATALYST=$IE_CATALYST"
  257.     fi
  258. fi
  259. }
  260.  
  261. search_netscape
  262. if [ "$NETSCAPE_CATALYST" = "" ]; then
  263.     search_ie
  264. fi
  265.  
  266. #echo "Please wait, $ISSUE_NAME $ISSUE_DATE is starting ..."
  267. #echo ""
  268.  
  269. if [ "$NETSCAPE_CATALYST" = "" -a "$IE_CATALYST" = "" ]; then
  270.     echo
  271.     echo
  272.     echo "Please enter the path to the DIRECTORY of either the Netscape or Internet Explorer version 4 or later executable:"
  273.     read user_path
  274. #echo "user_path=$user_path"
  275.     PATH=$PATH:$user_path
  276.  
  277.     search_netscape
  278.     if [ "$NETSCAPE_CATALYST" = "" ]; then
  279.         search_ie
  280.     fi
  281. fi
  282. #export CDWARE_ENV
  283.  
  284. $CD_MOUNT/products/bin/finish.sh &
  285. sleep 40
  286. exit 0
  287.